#include <bits/stdc++.h>

using namespace std;
using ll = long long;

ll query(int type, int l, int r){
    ll x;
    cout << type << ' ' << l << ' ' << r << flush << endl;
    cin >> x;
    return x;
}

void solve() {
    int n;
    cin >> n;

    ll sum = query(2, 1, n);
    sum -= ((n * (n + 1)) / 2);

    ll diff = sum - 1;
    int l = 1, r = n;

    while (l < r) {
        int md = (l + r) / 2;
        ll val1 = query(1, 1, md);
        ll val2 = query(2, 1, md);

        if (val1 < val2) r = md;
        else l = md + 1;
    }

    cout << "!" << ' ' << l << ' ' << diff + l << flush << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t;
    cin >> t;
    while (t-- > 0) solve();

    return 0;
}